# Copyright (c) 2009 Daropia Project (www.daropia.org)
#
# This file is part of Daropia and is available under the terms
# of the GNU General Public Licence version 2.0 or later.


# Define a subclass of Ramaze::Controller holding your defaults for all
# controllers

class Controller < Ramaze::Controller
  layout :default
  helper :xhtml, :user,  :stack, :blue_form, :partial
  helper :core_functions
  engine :Etanni

  def initialize
  	@title = "Daropia - Jeu Hautement Daropique"
  end

  protected

  def require_login
    return if logged_in?
    flash[:message] = "Vous devez être connecté pour acceder à cette fonction."
    call UserController.r(:login)
  end

  def require_admin
  	return if user.status == 'admin'
  	flash[:message] = "Vous devez être administrateur pour acceder à cette fonction."
  	call MainController.r(:index)
  end

end

# Here go your requires for subclasses of Controller:
require __DIR__('main')
require __DIR__('user')
require __DIR__('forum')
require __DIR__('topic')
require __DIR__('post')
require __DIR__('character')
require __DIR__('admin')
